﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MsTestUtilities.SolutionAnalysis;
using System.Linq;

namespace MsTestUtilitiesTests.SolutionAnalysisTests.SolutionTests.ProjectParsing
{
    [TestClass]
    public class SolutionFolderParsingTests : SolutionParsingFixture
    {
        private const string Header = @"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project(""{2150E333-8FDC-42A3-9474-1A3956D46DE8}"") = ""MySolutionFolder"", ""MySolutionFolder"", ""{9A3508B9-9DD8-4865-95F0-E1B772AB38C1}""
EndProject

";
        protected override string SolutionFileText
        {
	        get { return Header; }
        }
        
        [TestMethod]
        public void SolutionHasOneProject()
        {            
            Assert.AreEqual(1, SolutionFile.Entries.Count());
        }

        [TestMethod]
        public void ProjectName()
        {
            Assert.AreEqual("MySolutionFolder", SolutionFile.Entries.First().Name);
        }

        [TestMethod]
        public void RelativeProjectPath()
        {
            Assert.AreEqual(@"MySolutionFolder", SolutionFile.Entries.First().RelativePath);
        }

        [TestMethod]
        public void ProjectId()
        {
            Assert.AreEqual(new Guid("{9A3508B9-9DD8-4865-95F0-E1B772AB38C1}"), SolutionFile.Entries.First().Id);
        }

        [TestMethod]
        public void EntryTypeTest()
        {
            Assert.AreEqual(EntryType.Folder, SolutionFile.Entries.First().Type);
        }
    }
}
